package com.ctshk.app.system.controller;

import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.common.model.PageResponse;
import com.ctshk.common.web.support.BaseController;
import com.ctshk.rpc.system.dto.OperationLogDTO;
import com.ctshk.rpc.system.dto.SysBigClientDTO;
import com.ctshk.rpc.system.req.OperationLogReq;
import com.ctshk.rpc.system.service.IOperationLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * @description 操作日志
 * @author 谢诗宏
 * @date 2021/3/9
 */
@Api(tags="操作日志")
@RestController
@RequestMapping("/sys/operation/log")
public class OperationLogController extends BaseController {

    @DubboReference
    private IOperationLogService operationLogService;

    @ApiOperation(value="业务日志列表", notes="获取业务操作日志列表")
    @OperationLogAnnotation(operModul = OperationLogModel.SYSTEM, operType = OperationLogType.QUERY, operTitle = "业务日志列表", operDesc = "获取业务操作日志列表")
    @PostMapping("/business")
    public Result<PageResponse<OperationLogDTO>> add(@RequestBody @Valid OperationLogReq operationLogReq){
        return operationLogService.list(operationLogReq);
    }

    @ApiOperation(value="登录日志列表", notes="获取登录操作日志列表")
    @OperationLogAnnotation(operModul = OperationLogModel.SYSTEM, operType = OperationLogType.QUERY, operTitle = "登录日志列表", operDesc = "获取登录操作日志列表")
    @GetMapping("/login")
    public Result<SysBigClientDTO> query(){
        return null;
    }

}
